# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Thomas Arnhold <thomas at arnhold dot org>

pkgbase=libmwaw
pkgname=('libmwaw' 'libmwaw-docs')
pkgver=0.3.22
pkgrel=1
pkgdesc="Import library for some old mac text documents."
arch=('x86_64')
url="https://sourceforge.net/projects/libmwaw/"
license=('LGPL2.1' 'MPL')
makedepends=('librevenge' 'doxygen')
source=(https://sourceforge.net/projects/${pkgname}/files/${pkgname}/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.xz)
sha1sums=('86bc49bfc8766cdcb079d46ca9c874e0d4c1f9d4')
sha256sums=('a1a39ffcea3ff2a7a7aae0c23877ddf4918b554bf82b0de5d7ce8e7f61ea8e32')

build() {
  cd "${pkgname}"-${pkgver}
  ./configure --prefix=/usr
  make
}

check() {
  cd "${pkgname}"-${pkgver}
  make check
}

package_libmwaw() {

  depends=('librevenge')

  cd "${pkgname}"-${pkgver}
  make DESTDIR="$pkgdir" install

  # Split -docs
  mkdir -p ../docs/usr/share
  mv -t ../docs/usr/share "$pkgdir"/usr/share/doc
  rmdir "$pkgdir"/usr/share
}

package_libmwaw-docs() {

  pkgdesc+=" (documentation)"

  mv -t "$pkgdir" docs/*
}
